<?php
/**
 * * com_bib      Developed using Nooku Framework 0.7 (see README.php for revision number)
 * @package		Bib
 * @copyright   Copyright (C) 2009 Danny Buytaert. All rights reserved.
 * @license     http://www.gnu.org/copyleft/gpl.html GNU/GPLv2
 */

class ComBibModelBooks extends KModelTable
{       
        protected function _buildQueryJoins(KDatabaseQuery $query)
        {
                $query->join('LEFT', 'bib_authors AS au', 'au.bib_author_id = tbl.bib_author_id')
                          ->join('LEFT', 'bib_genres AS ge', 'ge.bib_genre_id = tbl.bib_genre_id');
        }
        
        protected function _buildQueryFields(KDatabaseQuery $query)
        {
                $query->select('au.name AS author')
                          ->select('ge.name AS genre');
                        
        }
        protected function _buildQueryWhere(KDatabaseQuery $query)
        {
                 $query->where('tbl.enabled', '=',  1);
                        
        }
        
        
}
